package com.cloud.lesson.control;

import com.cloud.lesson.enity.CommonResult;
import com.cloud.lesson.enity.Payment;
import com.cloud.lesson.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author: Mr.Lai
 * @createTime: 2021/01/08
 * @classNote:
 **/
@RestController
@Slf4j
public class OrderFeignController {
    @Resource
    PaymentFeignService paymentFeignService;

    @GetMapping(value = "/consumer/read/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id){

        return paymentFeignService.read(id);
    }

    @GetMapping(value = "/consumer/feign/timeout")
    public String paymentFeignTimeOut(){
        //openfeign-ribbon,客户端默认等待1秒钟
        return paymentFeignService.paymentFeignTimeOut();
    }

}
